//
//  LoginViewController.swift
//  DianShangWen
//
//  Created by 周文轩 on 15/4/2.
//  Copyright (c) 2015年 &#21608;&#25991;&#36713;. All rights reserved.
//

import UIKit
import Argo

var user: UserLogin!

class LoginViewController: UIViewController {
    
    @IBOutlet weak var emailTextField: UITextField!
    @IBOutlet weak var passwordTextField: UITextField!
    var loginBool: Bool! = false
    var populationBool: Int! = 0
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationController?.navigationBarHidden = true
        
        // Do any additional setup after loading the view.
    }
    
    @IBAction func UserLogin() {
        let serverRequest: () = ServerRequest.ServerRequest("system.authentication.user", requestStayle: ".post", params: ["username":emailTextField.text, "pwd":passwordTextField.text], tag: 10) { (dataDictionary) -> Void in
            let successcount = dataDictionary.objectForKey("success") as! Int
            if successcount == 0 {
                println("Cannot dismiss")
            }else {
                self.HasALookCasually()
            }
        }
    }
    
    @IBAction func HasALookCasually() {
        self.dismissViewControllerAnimated(true, completion: nil)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
